import { defineStore } from "pinia";

import { ipcApiRoute } from "@/api/main";
import { ipc } from "@/utils/ipcRenderer";

export const useConfigStore = defineStore("config", {
  // persist: true,
  state: () => ({
    baseConfig: {},
    configKeys: {},
    userFileHistory: [
      {dir: '123' , id: '123'}
    ],
  }),
  getters: {},
  actions: {
    getConfig() {
      ipc.invoke(ipcApiRoute.getConfig, "").then((res) => {
        this.baseConfig = res;
      });
      ipc.invoke(ipcApiRoute.getConfigKeys, "").then((res) => {
        this.configKeys = res;
      });
    },
    setUserFileHistory(history) {
      this.userFileHistory = history;
    },
  },
});
